<?php 
include 'form.class.php';
include 'search.class.php';
$search = new search();
//$types = $search->get_type();
if(isset($q)) $q = $search->strip($q);

if($q)
{
	$order = isset($order) ? intval($order) : 0;
	$page = max(intval($page), 1);
	$search->set($M['titlelen'], $M['descriptionlen'], 'red'); 
	$q = new_htmlspecialchars(strip_tags($q));
	$sdata = $search->q($q, $order, $page, 3,1);
	$spages = $search->pages;
	$total = $search->total;
	$usedtime = usedtime();
	
	$head['title'] = $q.'-'.$SETTING['sitename'];
	$head['keywords'] = $q.','.$SETTING['keywords'];
	$head['description'] = $q.','.$SETTING['description'];
	include template('list.html','search');
}
else
{
	$head['title'] = '搜索首页-'.$SETTING['sitename'];
	$head['keywords'] = $SETTING['keywords'];
	$head['description'] = $SETTING['description'];
	include template('index.html','search');
}
?>